import request from '@/utils/request.js'


const categoryApi = {
    selectCategoryTree() {
        return request.get('/product/category/selectCategoryTree', {})
    },
    selectByParentId(id) {
        return request.get(`/product/category/selectByParentId/${id}`, {})
    },
    deleteById(id) {
        return request.delete(`/product/category/deleteById/${id}`)
    },
    add(category) {
        //product以JSON形式传递到后台
        return request.post('/product/category/add', category)
    },
    selectById(id) {
        return request.get(`/product/category/selectById/${id}`)
    },
    update(category) {
        return request.put('/product/category/update', category)
    },
}

export default categoryApi
